//
//  Global.h
//  Rockval
//
//  Created by TuanNT on 4/27/14.
//  Copyright (c) 2014 TNL. All rights reserved.
//

#ifndef Rockval_Global_h
#define Rockval_Global_h

// The networking framework
#import "AFNetworking.h"

/* Blocking */
#import "SHUIKitBlocks.h"
#import "SHMessageUIBlocks.h"
#import "UIAlertView+Helpers.h"

// Some useful macros classes
#import "GONMacros_All.h"
#import "CJAMacros.h"
#import "AFMacros.h"

/* HUD */
#import "MBProgressHUD.h"
#import "UIViewController+HUD.h"

/* Grand Center Dispatch */
#import "GCDispatch.h"

/* Cordata helpers */
#define MR_ENABLE_ACTIVE_RECORD_LOGGING 0
#import "CoreData+MagicalRecord.h"

/* UIView helpers */
#import "UIView+Helpers.h"
#import "UIImageView+Curled.h"
#import "UIButton+Curled.h"
#import "SSToolkit.h"

/* Async image view */
#import "UIImageView+ProgressView.h"

/* The Side menu controller */
#import "MFSideMenu.h"
#import "UIViewController+MFSideMenuAdditions.h"

#import "UIViewController+Modal.h"

/* Location Manager */
#import "RCLocationManager.h"

/* Custom classes */
#import "DataManager.h"
#import "APIManager.h"
#import "Constants.h"

/* Data Models */
#import "DataModels.h"

/* Object request */
#import "ObLoginRequest.h"
#import "ObLoginResponse.h"
#import "ObSignUpRequest.h"
#import "ObSignUpResponse.h"
#import "PrimaryRole.h"
#import "state.h"
#import "ObProfileUpdateRequest.h"
#import "ObProfileResponse.h"
#import "ObMapListingRequest.h"
#import "ObMapListingResponse.h"
#import "ObListingDetailResponse.h"
#import "ObActionRequest.h"
#import "ObWatchingListRequest.h"

//works in DEBUG mode only
#ifndef __OPTIMIZE__
#define DebugLog(s, ...) NSLog(@"%s(%d): %@", __FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ## __VA_ARGS__])
#else
#define DebugLog(s, ...)
#endif

#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ## __VA_ARGS__);
#ifdef DEBUG
#   define ULog(fmt, ...)  { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ## __VA_ARGS__]  delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; }
#else
#   define ULog(...)
#endif

#define XCODE_COLORS_ESCAPE_MAC @"\033["
#define XCODE_COLORS_ESCAPE_IOS @"\xC2\xA0["

#define XCODE_COLORS_ESCAPE  XCODE_COLORS_ESCAPE_MAC

#define XCODE_COLORS_RESET_FG  XCODE_COLORS_ESCAPE @"fg;" // Clear any foreground color
#define XCODE_COLORS_RESET_BG  XCODE_COLORS_ESCAPE @"bg;" // Clear any background color
#define XCODE_COLORS_RESET     XCODE_COLORS_ESCAPE @";"   // Clear any foreground or background color

#define LogBlue(frmt, ...)  NSLog((XCODE_COLORS_ESCAPE @"fg0,0,255;" frmt XCODE_COLORS_RESET), ## __VA_ARGS__)

#ifdef DEBUG
#   define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ## __VA_ARGS__);
#else
#   define DLog(...)
#endif

#ifdef DEBUG
#define DLogError(frmt, ...) NSLog((@"%s [Line %d] " XCODE_COLORS_ESCAPE @"fg255,0,0;" frmt XCODE_COLORS_RESET), ## __VA_ARGS__)
#else
#define DLogError(...)
#endif

#ifdef DEBUG
#define DLogWarn(frmt, ...)  NSLog((@"%s [Line %d] " XCODE_COLORS_ESCAPE @"fg255,255,0;" frmt XCODE_COLORS_RESET), ## __VA_ARGS__)
#else
#define DLogWarn(...)
#endif

#endif
